var mongoose=require('mongoose');
var PlanSchema=new mongoose.Schema(
	{
		planname:{
			type:String
		},
		difficulty:{
			type:String
		},
		target:{
			type:String
		},
		region:{
			type:String
		},
		planMotions:[{
			motionname:String,
			motionZu:Number,
			motionNumber:Number,
			motionVolecity:Number,
			motionForce:Number,
			restTime:Number,
			motionBeat:Number
		}]
	});
	

PlanSchema.pre('save',function(next){
	console.log('保存成功');
	next();});

PlanSchema.statics={
	fetch:function(cb){
		return this.find({}).sort('').exec(cb);
	},
	findById:function(id,cb){
		return this.find({_id:id}).sort('').exec(cb);
	}
}

module.exports=PlanSchema;